package com.om39a.ds;

/**
 * @author om39a
 * 
 */
public class SelectionSort {
	public static void main(String[] args) {

		int[] val = { 6, 4, 3, 2, 7, 9, 5, 1, 0, 8 };
		int length = val.length;

		for (int i = 0; i < length; i++) {

			System.out.println("Initiating round " + i);
			for (int gg : val) {
				System.out.print(gg + " ");
			}

			int min = val[i];
			int min_pos = i;
			int temp;
			for (int j = i; j < length; j++) {
				if (min >= val[j]) {
					min = val[j];
					min_pos = j;
				}
			}
			temp = val[i];
			val[i] = val[min_pos];
			val[min_pos] = temp;
			System.out.println();
			for (int gg : val) {
				System.out.print(gg + " ");
			}
			System.out.println();

		}

	}

}
